package main.test.SparkAPI.Baics.collectapi

private case class Person(name: String)
object testVector {
  def testVec(): Unit ={
    val nums = Vector(1, 2, 3, 4, 5)

    val strings = Vector("one", "two")

    val peeps = Vector(
      Person("Bert"),
      Person("Ernie"),
      Person("Grover")
    )

    //  Instead you create a new sequence by appending or prepending elements to an existing Vector. For instance, given this Vector
    val a = Vector(1,2,3)
    // append elements like this
    val b = a :+ 4
    println(b.mkString("Vec( ",", "," )"))
    println( (a ++ Vector(4, 5)).mkString("Vec( ",", "," )"))


  }
  def main(args: Array[String]): Unit = {
    /**
     * The Vector class is an indexed,
     * immutable sequence. The “indexed” part
     * of the description means
     * that you can access Vector elements very rapidly by their
     * index value, such as accessing listOfPeople(999999).
     */
    testVec()

  }

}


